package com.example.a0529liuhongzhi.Fragment;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.fragment.app.Fragment;

import com.example.a0529liuhongzhi.Adapter.ListViewAdapter;
import com.example.a0529liuhongzhi.R;
import com.example.a0529liuhongzhi.lhz.Account;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 */
public class HomeFragment extends Fragment {

    ListViewAdapter listViewAdapter;
    List<Account> accounts;
    public HomeFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home, container, false);
        ListView  listView=view.findViewById(R.id.listview);
        accounts=new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            accounts.add(new Account(R.mipmap.car,"李先生",200.0));
        }
        listViewAdapter=new ListViewAdapter(accounts,getActivity());
        listView.setAdapter(listViewAdapter);
         return view;
    }

}
